﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoMapper;

namespace Data.Mappers
{
    public class UserMapper : IMapper<Entity.Users.User, ModelDatabase.User>
    {

        public Entity.Users.User WrapperData(ModelDatabase.User obj)
        {
            Mapper.CreateMap<ModelDatabase.User, Entity.Users.User>();
            Mapper.CreateMap<ModelDatabase.OrderPosition, Entity.Orders.OrderPosition>();

            return Mapper.Map<ModelDatabase.User, Entity.Users.User>(obj);
        }

        public List<Entity.Users.User> WrapperData(List<ModelDatabase.User> obj)
        {
            Mapper.CreateMap<ModelDatabase.User, Entity.Users.User>();
            Mapper.CreateMap<ModelDatabase.OrderPosition, Entity.Orders.OrderPosition>();

            return Mapper.Map<List<ModelDatabase.User>, List<Entity.Users.User>>(obj);
        }

        public ModelDatabase.User WrapperEntity(Entity.Users.User obj)
        {
            Mapper.CreateMap<Entity.Orders.OrderPosition, ModelDatabase.OrderPosition>();
            Mapper.CreateMap<Entity.Users.User, ModelDatabase.User>();

            return Mapper.Map<Entity.Users.User, ModelDatabase.User>(obj);
        }

        public List<ModelDatabase.User> WrapperEntity(List<Entity.Users.User> obj)
        {
            Mapper.CreateMap<Entity.Orders.OrderPosition, ModelDatabase.OrderPosition>();
            Mapper.CreateMap<Entity.Users.User, ModelDatabase.User>();

            return Mapper.Map<List<Entity.Users.User>, List<ModelDatabase.User>>(obj);
        }
    }
}
